package com.sensePlusVR.realGame;

import android.annotation.SuppressLint;

public class SimapleAction {
	private int type;
	private String Name;
	private int version;
	private int mainAction;
	private int minorAction;
	private int mFov;
	private int mCodecType;
	private int mCodecHeight;
	private int mCodecWidth;
	private int mCodecFps;
	private int mReversed;
	private int mSourceType;
	private String mDesVideo;
	private String mVideoFile;
	private String mVideoStreamLenFile;
	private String mAudioLow;
	private SimapleAudio mSampleAudioLow;
	private String mAudioMid;
	private SimapleAudio mSampleAudioMid;
	private String mAudioHeigh;
	private SimapleAudio mSampleAudioHeigh;
	private String mAudioIdle;
	private SimapleAudio mSampleAudioIdle;
	private String mVideoFile2;//idle videl
	private String mVideoFileHigh;//high video
	@SuppressLint("DefaultLocale")
	public String toString(){
		String val = null;
		if (getVersion() == 0)
		{
			val = String.format("%d,%s,%d,%d,%d,%d,%d,%d,%s,%s,%s", 
					type, Name, mainAction, minorAction, mCodecType, 
					mCodecWidth, mCodecHeight, mCodecFps, mVideoFile, 
					mVideoStreamLenFile, mReversed);
		}
		else if (getVersion() == 1)
		{
			val = String.format("V2:%s,%d,%d,%s,%s", Name, mainAction, minorAction, mVideoFile, 
					mVideoFile2);
		}
		else if (getVersion() == 3)
		{
			if (mVideoFile == null || mVideoFile2 == null || mVideoFileHigh == null){
				val = null;
			}else {
				val = String.format("V3:%s,%d,%d,%s,%s,%s", Name, mainAction, minorAction, mVideoFile, 
					mVideoFile2,mVideoFileHigh);
			}
		}	
		return val;
	}
	
	public String getmVideoFileHigh() {
		return mVideoFileHigh;
	}

	public void setmVideoFileHigh(String mVideoFileHigh) {
		this.mVideoFileHigh = mVideoFileHigh;
	}

	public byte[] toByte(){
		String val = toString();
		return val.getBytes();
	}
	
	public int getType() {
		return type;
	}
	public void setType(int type) {
		this.type = type;
	}
	public int getFov() {
		return mFov;
	}

	public void setFov(int Fov) {
		this.mFov = Fov;
	}
	public int getSourceType()
	{
		return mSourceType;
	}
	public void setSourceType(int stype)
	{
		this.mSourceType = stype;
	}
	public int getVersion()
	{
		return version;
	}
	public void setVersion(int ver)
	{
		this.version = ver;
	}
	public String getName() {
		return Name;
	}
	public void setName(String name) {
		Name = name;
	}
	public int getMainAction() {
		return mainAction;
	}
	public void setMainAction(int mainAction) {
		this.mainAction = mainAction;
	}
	public int getMinorAction() {
		return minorAction;
	}
	public void setMinorAction(int minorAction) {
		this.minorAction = minorAction;
	}
	public int getmCodecType() {
		return mCodecType;
	}
	public void setmCodecType(int mCodecType) {
		this.mCodecType = mCodecType;
	}
	public int getmCodecHeight() {
		return mCodecHeight;
	}
	public void setmCodecHeight(int mCodecHeight) {
		this.mCodecHeight = mCodecHeight;
	}
	public int getmCodecWidth() {
		return mCodecWidth;
	}
	public void setmCodecWidth(int mCodecWidth) {
		this.mCodecWidth = mCodecWidth;
	}
	public int getmCodecFps() {
		return mCodecFps;
	}
	public void setmCodecFps(int mCodecFps) {
		this.mCodecFps = mCodecFps;
	}
	public String getmDesVideo()
	{
		return mDesVideo;
	}
	public void setmDesVideo(String video)
	{
		this.mDesVideo = video;
	}
	public String getmVideoFile() {
		return mVideoFile;
	}
	public void setmVideoFile(String mVideoFile) {
		this.mVideoFile = mVideoFile;
	}
	public String getmVideoStreamlenFile() {
		return mVideoStreamLenFile;
	}
	public void setmVideoStreamlenFile(String mVideoStreamLenFile) {
		this.mVideoStreamLenFile = mVideoStreamLenFile;
	}

	public String getmVideoFile2() {
		return mVideoFile2;
	}

	public void setmVideoFile2(String mVideoFile2) {
		this.mVideoFile2 = mVideoFile2;
	}

	public String getmAudioLow() {
		//return mAudioLow;
		if (mSampleAudioLow == null) {
			return null;
		}
		return mSampleAudioLow.getRandomAudio();
	}

	public void setmAudioLow(String dir, String mAudioLow) {
		this.mAudioLow = mAudioLow;
		mSampleAudioLow =new SimapleAudio();
		String sp[] = mAudioLow.split(",");
		for (String f:sp){
			mSampleAudioLow.addAudioFile(dir+f);
		}
	}

	public String getmAudioMid() {
		//return mAudioMid;
		if (mSampleAudioMid == null){
			return null;
		}
		return mSampleAudioMid.getRandomAudio();
	}

	public void setmAudioMid(String dir, String mAudioMid) {
		this.mAudioMid = mAudioMid;
		mSampleAudioMid =new SimapleAudio();
		String sp[] = mAudioMid.split(",");
		for (String f:sp){
			mSampleAudioMid.addAudioFile(dir+f);
		}
	}

	public String getmAudioHeigh() {
		//return mAudioHeigh;
		if (mSampleAudioHeigh == null)
			return null;
		return mSampleAudioHeigh.getRandomAudio();
	}

	public void setmAudioHeigh(String dir, String mAudioHeigh) {
		this.mAudioHeigh = mAudioHeigh;
		mSampleAudioHeigh =new SimapleAudio();
		String sp[] = mAudioHeigh.split(",");
		for (String f:sp){
			mSampleAudioHeigh.addAudioFile(dir+f);
		}
	}

	public int getmReversed() {
		return mReversed;
	}

	public void setmReversed(int mReversed) {
		this.mReversed = mReversed;
	}

	public String getmAudioIdle() {
		//return mAudioIdle;
		if (mSampleAudioIdle == null)
			return null;
		return mSampleAudioIdle.getRandomAudio();
	}

	public void setmAudioIdle(String dir, String mAudioIdle) {
		this.mAudioIdle = mAudioIdle;
		mSampleAudioIdle =new SimapleAudio();
		String sp[] = mAudioIdle.split(",");
		for (String f:sp){
			mSampleAudioIdle.addAudioFile(dir+f);
		}
	}
}
